/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
// -*- coding:iso-8859-15 mode: c++ -*-
/** 
 * \file
 * \brief Logger upper class header.
 * \author Matthieu Myrsky <matthieu.myrsky@tkk.fi>
 *
 * $Id: Logger.hpp,v 1.5 2009-06-12 12:49:23 morsko Exp $
 *
 */
#ifndef _LOGGER_HPP_
#define _LOGGER_HPP_
#include <string>

#include <map>
#include "Component.hpp"

class Logger{
public:

  typedef std::map<std::string, bool> TMenu;

  /**
   * Constructor
   * 
   */
  Logger();
    

  /**
   * Destructor
   */
  virtual ~Logger();

  /** 
   * Function to add service to connect
   */
  virtual void SetService(const Gimbo::TServiceAssignment &service);

  /**
   * Set filename that the logger use. If not set, logger use it's default
   * filename
   * 
   * @param aFilename      Filename to use. Logger will usually add '.txt' at the end
   */
  virtual void SetFilename(std::string aFilename);

  /**
   * Set the logger to use its own default filename
   */
  virtual void SetDefaultFilename();

  /**
   * Starts logging selected type(s)
   *
   * @return      True if logging started, else false
   */
  virtual bool StartLogging(void)= 0;

  /**
   * Stops logging selected type(s)
   *
   * @return      True if logging started, else false
   */
  virtual bool StopLogging(void)= 0;

  /**
   * Returns the services assigned of the logger
   *
   * @return  Services assigned to logger
   */
  virtual Gimbo::TServiceAssignment GetService(void); 

  /**
   * Returns the name of the logger. Right now it's not used by GUI
   * @return name of the logger
   */
  virtual std::string GetName(void) =0;

  /**
   * Returns aTMenu to be shown 
   * Can be used e.g. to switch on/off log types
   */
  virtual TMenu *GetMenu(void){return NULL;}

  virtual bool SetMenuItem(std::string aItem, bool aValue){ return false;}

  /**
   * Returns additional information next to logger name.
   * E.g. Position logger could show current position
   */
  virtual bool GetAdditionalInformation(std::string &aInformation){return false;}

  /**
   * aN measurements are skipped after a measurement has been logged
   *
   * @param[in] aN         aN measurements are skipped after a measurement has been logged
   * @return               true if logger supports this feature and the value is right
   *
   */
  virtual bool SkipNMeasurements(unsigned int aN);

  /**
   * Tells if the logger support measurement skipping feature
   */
  virtual bool SupportMeasurementSkipping(){ return false;}
protected:

  std::string iFilename;
  bool iFilenameSet;

  const std::string iName;
  Gimbo::TServiceAssignment iService;
  

};

#endif
